-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow overriding height and width attributes #8
Comments
Note: Setting CSS does work around it, but I'd rather have the mark up just be correct out-of-the-box. |
I think this is because options are passed using query string. Is it possible to provide options using an object instead? |
Thanks @neoziro. Unfortunately, webpack-configurator only supports Adding options in the loader config throws: There were errors with your webpack config:
[1]
module.loaders.7.options
object.allowUnknown , "options" is not allowed Gatsby v2 no longer depends on webpack-configurator, but until it becomes available (which could be a while) we can't use |
Is it possible to pass |
I think yes because this is what I get with the options: return React.createElement("svg", _extends({
fill: "none",
stroke: "currentColor",
strokeWidth: 2,
strokeLinecap: "round",
strokeLinejoin: "round",
className: "feather feather-search"
}, props, {
width: "1em",
height: "1em",
ref: svgRef
}), _ref2, _ref3);
}; Everything is okay. I was also mistaken when I said it wasn't respecting Also, when I do <SearchIcon viewBox="0 0 12 12" width="4em" height="4em" /> I get <svg viewBox="0 0 12 12" width="1em" height="1em"> Other options like |
I'm taking a look at SVR's source to see if I can track it down. |
After further investigation, I believe this is a bug with how svgr does the transforms. I edited the Even with the cli, <svg viewBox="0 0 88 88" {...props} width="1em" height="1em"> The width and height attrs are inserted after the rest props are spread which is why we can't override it. |
Resolved in svgr 1.9.1. Thanks @neoziro |
I'm using the config options of
{ icon: true, viewBox: false }
.When doing (roughly) this:
The final render is (roughly):
I expected the
width
to be1.125em
.The text was updated successfully, but these errors were encountered: